//
//  IndustryCell.m
//  FKGW
//
//  Created by song ce on 2017/2/16.
//  Copyright © 2017年 song ce. All rights reserved.
//

#import "IndustryCell.h"
#import "UIImageView+WebCache.h"
#import "UIView+Extend.h"
#import "OSSHelper.h"
@implementation IndustryCell

- (void)awakeFromNib {
    [super awakeFromNib];
    self.selectionStyle =UITableViewCellSelectionStyleNone;
    // Initialization code
//    self.imageView.image = [UIImage imageNamed:@"content_banner_2"];
  
//    [self.imageV sd_setImageWithURL:[NSURL URLWithString:@"https://a1.easemob.com/1128170322178749/cengfengkeji/chatfiles/f9af1bb0-1109-11e7-b3ad-b5edceeb2a19"]];
}

-(void)setModel:(IndustryModel *)model{
    _model = model;
    NSArray *pics = _model.pics;
    for(int i=0;i<pics.count;i++){
        CGFloat with = Main_Screen_Width/pics.count;
        UIImageView *iamgeV = [[UIImageView alloc]initWithFrame:CGRectMake(i*with, 0, with, self.height)];
        [self.contentView addSubview:iamgeV];
        [self setImageWithPic:pics[i] xossProcess:[NSString stringWithFormat:@"image/resize,m_fill,w_%d,h_%d",(int)with,(int)with] iamgeV:iamgeV];
    }
}

-(void)setImageWithPic:(NSString *)pic xossProcess:(NSString*)xOssProcess iamgeV:(UIImageView*)imageV{
    [[OSSHelper sharedHelper] OSSDownLoadWithObjectKey:pic xOssProcess:xOssProcess  downLoadBlock:^(NSData *data) {
        dispatch_async(dispatch_get_main_queue(), ^{
            imageV.image = [UIImage imageWithData:data];
        });
    }];
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

}

@end
